<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/common/common.jsp"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>学生查看报名面试</title>
    <link rel="stylesheet" href="./css/layui.css">
  </head>
  
  <body>
   <form class="layui-form" id="form" action="<%= basePath%>/PlanAction_listExamine" method="post">
    <blockquote class="layui-elem-quote mylog-info-tit">
        <div class="layui-input-inline">
    		  <input type="text" name="planName" placeholder="请输入招聘计划名称" autocomplete="off" class="layui-input" >
 	 	</div>
        <button class="layui-btn" lay-submit name="formDemo">搜索</button>
    </blockquote>
</form>
<table class="layui-table" lay-even  lay-size="sm" lay-filter="demo">
    <thead>
    <tr>
        <th> 编 号 </th>
        <th>招聘计划编号</th>
        <th>招聘计划名称</th>
        <th>岗位要求</th>
        <th>招聘人数 </th>
         <th>报名人（当前登录用户） </th>
        <th> 操 作  </th>
    </tr>
    </thead>
    <tbody>
      <c:forEach var="list" items="${list}">
            <tr>
                <td>${list.id}</td>
                <td>${list.planId}</td>
                <td>${list.planName}</td>
                <td>${list.requirement}</td>
                <td>${list.num}</td>
                <td>${LoginUser} </td>
                               <th>
                    <a class="layui-btn layui-btn-mini" href="StaffAction_add?LoginUser=${LoginUser}&aaa=${list.planId}&bbb=${list.planName}&ccc=${list.requirement}" onchange="verify()">报名</a>
                </th>
            </tr>
  	 </c:forEach>
    </tbody>
</table>
<div id="demo7"></div>

<!-- js控件 -->
<script src="<%=path%>/js/layui.all.js" type="text/javascript"></script>
 
<script type="text/javascript">
    function verify() {
        $.ajax({
            type: "get",
            url:"StaffAction_verify",
            data:{
                username:$("#username").val()
            },
            success(data){
                if (data=="SUCCESS"){
                    alert("用户名已经存在，已报名！！");
                } else {
                    // 这里应该不做反应，或是与if进行反向操作
                    alert("");
                }
            },
            error(){
                alert("ajax配置有错，请检查url与type是否正确");
            }
        });
    } 
</script>
  </body>
</html>
